//
// Created by napo on 22-11-21.
//

#ifndef CARP_408_H
#define CARP_408_H

#include "head.h"

//408-2009.42
int getNode(LinkList L, int k) {

    if(k <= 0)
        return 0;

    LNode *p = L;
    LNode *q = L;
    for(int i=0; i<k; i++) {
        if(p != NULL)
            p = p->next;
        else return 0;
    }

    while (p != NULL) {
        p=p->next;
        q=q->next;
    }

    std::cout << q->date;

    return 1;
}

//408-2010.42
void Rverse(int A[], int begi, int en) {
    for(int i=0; i<(en-begi+1)/2;i++) {
        std::swap(A[begi+i], A[en-i]);
    }
}

void leftMove(int A[], int n, int p) {
    Rverse(A, 0, p-1);
    Rverse(A,p,n-1);
    Rverse(A,0,n-1);

    for(int i=0;i<n;i++){
        std::cout << A[i] << " ";
    }
}

#endif //CARP_408_H